package com.shy.task.quartz.job.impl;

import java.util.concurrent.TimeUnit;

import com.shy.base.component.ApplicationContextProvider;
import com.shy.task.entity.TaskEntity;
import com.shy.task.quartz.job.AbstractMutexJob;
import com.shy.task.service.TaskEntityService;

import lombok.extern.slf4j.Slf4j;

/**
 * 测试互斥任务
 *
 * @author shanhanyu
 * @date 2018/9/11 - 14:04
 */
@Slf4j
public class DemoMutexJob002 extends AbstractMutexJob {

	@Override
	public void doExecute(String workDate) {
		log.info("测试demoMutexJob002开始执行...");
		try {
			TimeUnit.SECONDS.sleep(20);
		} catch (InterruptedException e) {
			log.error(e.getMessage(), e);
			Thread.currentThread().interrupt();
		}
		ApplicationContextProvider.getBean(TaskEntityService.class).findByProperty("status", 1).forEach(System.out::println);
		log.info("测试demoMutexJob002结束执行...");
	}

	@Override
	public void doExecute(String workDate, TaskEntity taskcfg) {
		
	}
}
